<?php

/**
 * This is the model class for table "tbl_resp".
 *
 * The followings are the available columns in table 'tbl_resp':
 * @property integer $rma_id
 * @property string $rma_codigo
 * @property integer $rma_municipio
 * @property string $rma_boleta
 * @property string $rma_tipobol
 * @property integer $rma_gestion
 * @property string $rma_fecha
 * @property integer $rma_estado
 */
class tbl_resp extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return tbl_resp the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'tbl_resp';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('rma_codigo, rma_municipio, rma_boleta, rma_tipobol, rma_gestion', 'required'),
			array('rma_municipio, rma_gestion, rma_estado', 'numerical', 'integerOnly'=>true),
			array('rma_codigo', 'length', 'max'=>7),
			array('rma_boleta', 'length', 'max'=>5),
			array('rma_tipobol', 'length', 'max'=>6),
			array('rma_fecha', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('rma_id, rma_codigo, rma_municipio, rma_boleta, rma_tipobol, rma_gestion, rma_fecha, rma_estado', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'rma_id' => 'Rma',
			'rma_codigo' => 'Rma Codigo',
			'rma_municipio' => 'Rma Municipio',
			'rma_boleta' => 'Rma Boleta',
			'rma_tipobol' => 'Rma Tipobol',
			'rma_gestion' => 'Rma Gestion',
			'rma_fecha' => 'Rma Fecha',
			'rma_estado' => 'Rma Estado',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('rma_id',$this->rma_id);

		$criteria->compare('rma_codigo',$this->rma_codigo,true);

		$criteria->compare('rma_municipio',$this->rma_municipio);

		$criteria->compare('rma_boleta',$this->rma_boleta,true);

		$criteria->compare('rma_tipobol',$this->rma_tipobol,true);

		$criteria->compare('rma_gestion',$this->rma_gestion);

		$criteria->compare('rma_fecha',$this->rma_fecha,true);

		$criteria->compare('rma_estado',$this->rma_estado);

		return new CActiveDataProvider('tbl_resp', array(
			'criteria'=>$criteria,
		));
	}
}